package com.ruoyi.web.controller.kiku;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.kiku.domain.KikuOrangeSupport;
import com.ruoyi.kiku.service.IKikuOrangeSupportService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 橘子应援信息Controller
 *
 * @author TT
 * @date 2025-07-31
 */
@RestController
@RequestMapping("/kiku/support")
public class KikuOrangeSupportController extends BaseController
{
    @Autowired
    private IKikuOrangeSupportService kikuOrangeSupportService;

    /**
     * 查询橘子应援信息列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:support:list')")
    @GetMapping("/list")
    public TableDataInfo list(KikuOrangeSupport kikuOrangeSupport)
    {
        startPage();
        List<KikuOrangeSupport> list = kikuOrangeSupportService.selectKikuOrangeSupportList(kikuOrangeSupport);
        return getDataTable(list);
    }

    /**
     * 导出橘子应援信息列表
     */
    @PreAuthorize("@ss.hasPermi('kiku:support:export')")
    @Log(title = "橘子应援信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, KikuOrangeSupport kikuOrangeSupport)
    {
        List<KikuOrangeSupport> list = kikuOrangeSupportService.selectKikuOrangeSupportList(kikuOrangeSupport);
        ExcelUtil<KikuOrangeSupport> util = new ExcelUtil<KikuOrangeSupport>(KikuOrangeSupport.class);
        util.exportExcel(response, list, "橘子应援信息数据");
    }

    /**
     * 获取橘子应援信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:support:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(kikuOrangeSupportService.selectKikuOrangeSupportById(id));
    }

    /**
     * 新增橘子应援信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:support:add')")
    @Log(title = "橘子应援信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody KikuOrangeSupport kikuOrangeSupport)
    {
        return toAjax(kikuOrangeSupportService.insertKikuOrangeSupport(kikuOrangeSupport));
    }

    /**
     * 修改橘子应援信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:support:edit')")
    @Log(title = "橘子应援信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody KikuOrangeSupport kikuOrangeSupport)
    {
        return toAjax(kikuOrangeSupportService.updateKikuOrangeSupport(kikuOrangeSupport));
    }

    /**
     * 删除橘子应援信息
     */
    @PreAuthorize("@ss.hasPermi('kiku:support:remove')")
    @Log(title = "橘子应援信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(kikuOrangeSupportService.deleteKikuOrangeSupportByIds(ids));
    }
}
